package com.chenhy.springbootvuesmbms.controller;

import com.chenhy.springbootvuesmbms.pojo.CommonResult;
import com.chenhy.springbootvuesmbms.pojo.User;
import com.chenhy.springbootvuesmbms.service.LoginServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class LoginController {

    @Autowired
    private LoginServer loginServer;

    @PostMapping("/login")
    public CommonResult login(@RequestBody User user){
        // 登录
        System.out.println("进入了");
        return loginServer.login(user);
    }

    @PostMapping("/logout")
    public CommonResult logout(){
        return loginServer.logout();
    }

}
